package com.zishi.mapper;

import com.zishi.model.pojo.Article;
import com.zishi.model.pojo.UserArticleRef;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户点赞和收藏的文章表 Mapper 接口
 * </p>
 *
 * @author TP
 * @since 2022-05-05 08:53:41
 */
@Mapper
public interface UserArticleRefMapper extends BaseMapper<UserArticleRef> {

    /**
     * 根据用户id获取其收藏的所有文章
     */
    List<Article> getBatchUserArticle(@Param("userId") int userId);

    /**
     * 用户点赞或收藏该文章
     */
    boolean updateLikeOrCollection(@Param("userId")Integer userId, @Param("articleId")Integer articleId, @Param("liked")Integer liked, @Param("collected")Integer collected);
}
